home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / vm / vm.h < prev    next >
C/C++ Source or Header  |  1991-08-09  |  20KB  |  556 lines

  1. /*
  2.  * vm.h --
  3.  *
  4.  *     Virtual memory data structures and procedure headers exported by
  5.  *     the virtual memory module.
  6.  *
  7.  * Copyright 1986 Regents of the University of California
  8.  * All rights reserved.
  9.  *
  10.  *
  11.  * $Header: /sprite/src/kernel/vm/RCS/vm.h,v 9.13 91/08/09 15:00:10 shirriff Exp $ SPRITE (Berkeley)
  12.  */
  13.  
  14.  
  15. #ifndef _VM
  16. #define _VM
  17.  
  18. #include <list.h>
  19.  
  20. #ifdef KERNEL
  21. #include <user/vm.h>
  22. #if 0
  23. #include <vmMach.h>
  24. #endif
  25. #include <vmStat.h>
  26. #include <fs.h>
  27. #include <sync.h>
  28. #include <proc.h>
  29. #include <procMigrate.h>
  30. #include <sprite.h>
  31. #else
  32. #if 0
  33. #include <kernel/vmMach.h>
  34. #endif
  35. #include <vmStat.h>
  36. #include <kernel/fs.h>
  37. #include <kernel/sync.h>
  38. #include <kernel/proc.h>
  39. #include <kernel/procMigrate.h>
  40. #include <sprite.h>
  41. #endif
  42.  
  43. /*
  44.  * Structure to represent a translated virtual address
  45.  */
  46. typedef struct Vm_VirtAddr {
  47.     struct Vm_Segment    *segPtr;    /* Segment that address falls into.*/
  48.     int         page;        /* Virtual page. */
  49.     int         offset;        /* Offset in the page. */
  50.     int            flags;        /* Flags defined below */
  51.     struct Vm_SegProcList    *sharedPtr;    /* Pointer to shared seg. */
  52. } Vm_VirtAddr;
  53.  
  54. /*
  55.  * Values for flags field.  Lower 8 bits are for our use, next 8 bits are 
  56.  * machine dependent.
  57.  *
  58.  *    VM_HEAP_PT_IN_USE    The heap segment for the current process had
  59.  *                its page table marked as being in use.
  60.  *    VM_READONLY_SEG        The segment is read only for this process.
  61.  */
  62. #define    VM_HEAP_PT_IN_USE    0x1
  63. #define VM_READONLY_SEG        0x2
  64. /*
  65.  * A page table entry.
  66.  */
  67. typedef unsigned int    Vm_PTE;
  68.  
  69. /*
  70.  * Flags to set and extract the fields of the PTE.
  71.  *
  72.  *    VM_VIRT_RES_BIT        The page is resident in the segment's virtual
  73.  *                address space.
  74.  *    VM_PHYS_RES_BIT        The page is physically resident in memory.
  75.  *      VM_ZERO_FILL_BIT    The page should be filled on demand with zeros.
  76.  *    VM_ON_SWAP_BIT        The page is on swap space.
  77.  *    VM_IN_PROGRESS_BIT    A page fault is occuring on this page.
  78.  *    VM_COR_BIT        The page is copy-on-reference.
  79.  *    VM_COW_BIT        The page is copy-on-write.
  80.  *    VM_REFERENCED_BIT    The page has been referenced.
  81.  *    VM_MODIFIED_BIT        The page has been modified.
  82.  *      VM_READ_ONLY_PROT    The page is read-only.
  83.  *    VM_COR_CHECK_BIT    The page is marked read-only after a cor fault
  84.  *                to determine if the page will in fact get
  85.  *                modified.
  86.  *    VM_PAGE_FRAME_FIELD    The virtual page frame that this page is 
  87.  *                resident in.
  88.  */
  89. #define    VM_VIRT_RES_BIT        0x80000000
  90. #define VM_PHYS_RES_BIT        0x40000000
  91. #define VM_ZERO_FILL_BIT    0x20000000
  92. #define VM_ON_SWAP_BIT        0x10000000
  93. #define VM_IN_PROGRESS_BIT    0x08000000
  94. #define VM_COR_BIT        0x04000000
  95. #define VM_COW_BIT        0x02000000
  96. #define VM_REFERENCED_BIT    0x01000000
  97. #define VM_MODIFIED_BIT        0x00800000
  98. #define VM_READ_ONLY_PROT    0x00400000
  99. #define VM_COR_CHECK_BIT    0x00200000
  100. #define VM_PREFETCH_BIT        0x00100000
  101. #define VM_PAGE_FRAME_FIELD    0x000fffff
  102.  
  103. /*
  104.  * Macro to get a page frame out of a PTE.
  105.  */
  106. #define Vm_GetPageFrame(pte) ((unsigned int) ((pte) & VM_PAGE_FRAME_FIELD))
  107.  
  108. /*
  109.  * The page size.
  110.  */
  111. extern    int    vm_PageSize;
  112.  
  113. /*
  114.  * The end of allocated kernel+data memory.
  115.  */
  116. extern    Address    vmMemEnd;
  117.  
  118. /*
  119.  * The type of accessibility desired when making a piece of data user
  120.  * accessible.  VM_READONLY_ACCESS means that the data will only be read and
  121.  * will not be written.  VM_OVERWRITE_ACCESS means that the entire block of
  122.  * data will be overwritten.  VM_READWRITE_ACCESS means that the data 
  123.  * will both be read and written.
  124.  */
  125. #define    VM_READONLY_ACCESS        1
  126. #define    VM_OVERWRITE_ACCESS        2
  127. #define    VM_READWRITE_ACCESS        3
  128.  
  129. /*
  130.  * Structure that contains relevant info from the aout header to allow
  131.  * reuse of sticky segments.
  132.  */
  133. typedef struct {
  134.     int    heapPages;
  135.     int    heapPageOffset;
  136.     int    heapFileOffset;
  137.     int    bssFirstPage;
  138.     int    bssLastPage;
  139.     int    entry;
  140.     int flags;
  141.     int heapExcess;
  142. } Vm_ExecInfo;
  143.  
  144. /*
  145.  * The segment table structure.  Details about the segment table and
  146.  * some of the fields in here are defined in vmInt.h.
  147.  *
  148.  * NOTE: Process migration requires that the five fields offset, fileAddr,
  149.  *       type, numPages and ptSize be contiguous.
  150.  */
  151. typedef struct Vm_Segment {
  152.     List_Links        links;        /* Links used to put the segment
  153.                      * table entry in list of free segments,
  154.                      * list of inactive segments or list
  155.                      * of copy-on-write segments. */
  156.     int            segNum;        /* The number of this segment. */
  157.     int         refCount;    /* Number of processes using this 
  158.                      * segment */
  159.     Sync_Condition    condition;    /* Condition to wait on for this
  160.                      * segment. */
  161.     Fs_Stream        *filePtr;    /* Pointer to the file that pages are
  162.                      * being demanded loaded from. */
  163.                         /* Name of object file for code 
  164.                      * segments. */
  165.     char        objFileName[VM_OBJ_FILE_NAME_LENGTH];
  166.     Fs_Stream        *swapFilePtr;    /* Structure for an opened swap file.*/
  167.     char        *swapFileName;  /* The filename associated with the
  168.                      * swap file. */
  169.     int            offset;        /* Explained in vmInt.h. */
  170.     int            fileAddr;    /* The address in the object file where
  171.                      * data or code for this segment 
  172.                      * begins. */
  173.     int               type;        /* CODE, STACK, HEAP, or SYSTEM */
  174.     int            numPages;    /* Explained in vmInt.h. */
  175.     int            ptSize;        /* Number of pages in the page table */
  176.     int            resPages;    /* Number of pages in physical memory
  177.                      * for this segment. */
  178.     Vm_PTE        *ptPtr;        /* Pointer to the page table for this 
  179.                      * segment */
  180.     struct VmMach_SegData *machPtr;    /* Pointer to machine dependent data */
  181.     int            flags;        /* Flags to give information about the
  182.                      * segment table entry. */
  183.     List_Links        procListHdr;    /* Header node for list of processes
  184.                      * sharing this segment. */
  185.     List_Links        *procList;    /* Pointer to list of processes 
  186.                      * sharing this segment. */
  187.     int            ptUserCount;    /* The number of current users of this
  188.                      * page table. */
  189.     ClientData        fileHandle;    /* Handle for object file. */
  190.     Vm_ExecInfo        execInfo;    /* Information to allow reuse of 
  191.                      * sticky segments. */
  192.     struct VmCOWInfo    *cowInfoPtr;    /* Pointer to copy-on-write list 
  193.                      * header. */
  194.     int            numCOWPages;    /* Number of copy-on-write pages that
  195.                      * this segment references. */
  196.     int            numCORPages;    /* Number of copy-on-ref pages that
  197.                      * this segment references. */
  198.     Address        minAddr;    /* Minimum address that the segment
  199.                      * can ever have. */
  200.     Address        maxAddr;    /* Maximium address that the segment
  201.                      * can ever have. */
  202.     int            traceTime;    /* The last trace interval that this
  203.                      * segment was active. */
  204.  
  205. } Vm_Segment;
  206.  
  207. /*
  208.  * Pointer to the system segment.
  209.  */
  210. extern     Vm_Segment    *vm_SysSegPtr;
  211.  
  212. /*
  213.  * Information stored by each process.
  214.  */
  215. typedef struct Vm_ProcInfo {
  216.     Vm_Segment            *segPtrArray[VM_NUM_SEGMENTS];
  217.     int                numMakeAcc;    /* Nesting level of make
  218.                          * make accessibles for this
  219.                          * process. */
  220.     struct VmMach_ProcData    *machPtr;    /* Pointer to machine dependent
  221.                          * data. */
  222.     int                vmFlags;    /* Flags defined below. */
  223.     List_Links            *sharedSegs;    /* Process's shared segs. */
  224.     Address            sharedStart;    /* Start of shared region.  */
  225.     Address            sharedEnd;    /* End of shared region.  */
  226. } Vm_ProcInfo;
  227.  
  228. /*
  229.  * List of the shared segments.
  230.  * There is one of these entries for each shared segment.
  231.  */
  232. typedef struct Vm_SharedSegTable {
  233.     List_Links          segList;        /* Links of shared segments. */
  234.     int                 serverID;       /* Server of associated file. */
  235.     int                 domain;         /* Domain of associated file. */
  236.     int                 fileNumber;     /* File number of associated file. */
  237.     struct Vm_Segment   *segPtr;        /* Shared segment. */
  238.     int                 refCount;       /* Number of references to segment.
  239. */
  240. } Vm_SharedSegTable;
  241.  
  242. /*
  243.  * Shared segments associated with a process.
  244.  * There is one of these entries for each processor-segment mapping.
  245.  */
  246. typedef struct Vm_SegProcList {
  247.     List_Links          segList;        /* Links of shared segments. */
  248.     int                 fd;             /* File descriptor of the mapping. */
  249.     Vm_SharedSegTable   *segTabPtr;     /* Pointer to shared segment table. */
  250.     Address             addr;           /* Start address of segment. */
  251.     int            offset;        /* Page table offset (see vmInt.h). */
  252.     int            fileAddr;    /* Offset into the file. */
  253.     Address             mappedStart;    /* Start of mapped part. */
  254.     Address             mappedEnd;      /* End of mapped part. */
  255.     Fs_Stream           *stream;        /* Stream of mapping. */
  256.     int                 prot;           /* Protections of segment. */
  257. } Vm_SegProcList;
  258.  
  259. /*
  260.  * Values for the vmFlags field.
  261.  *
  262.  * VM_COPY_IN_PROGRESS          Data is being copied from/to this process
  263.  *                              to/from the kernel's VAS.
  264.  */
  265. #define VM_COPY_IN_PROGRESS             0x01
  266.  
  267. /*
  268.  * Maximum number of pages that a user process can wire down with the
  269.  * Vm_PinUserMem call.
  270.  */
  271. #define    VM_MAX_USER_MAP_PAGES    4
  272.  
  273. /*
  274.  * Copy-on-write level.
  275.  */
  276. extern    Boolean    vm_CanCOW;
  277.  
  278. /*
  279.  * Maximum number of pageout processes.  This information is needed in
  280.  * order to configure the correct number of Proc_ServerProcs
  281.  */
  282. #define VM_MAX_PAGE_OUT_PROCS    3
  283.  
  284. /*
  285.  * The initialization procedures.
  286.  */
  287. extern void Vm_BootInit _ARGS_((void));
  288. extern void Vm_Init _ARGS_((void));
  289.  
  290. /*
  291.  * Procedure for segments
  292.  */
  293. extern void Vm_SegmentIncRef _ARGS_((Vm_Segment *segPtr, Proc_ControlBlock *procPtr));
  294. extern Vm_Segment *Vm_FindCode _ARGS_((Fs_Stream *filePtr, Proc_ControlBlock *procPtr, Vm_ExecInfo **execInfoPtrPtr, Boolean *usedFilePtr));
  295. extern void Vm_InitCode _ARGS_((Fs_Stream *filePtr, register Vm_Segment *segPtr, Vm_ExecInfo *execInfoPtr));
  296. extern void Vm_FlushCode _ARGS_((Proc_ControlBlock *procPtr, Address addr, int numBytes));
  297. extern Vm_Segment *Vm_SegmentNew _ARGS_((int type, Fs_Stream *filePtr, int fileAddr, int numPages, int offset, Proc_ControlBlock *procPtr));
  298. extern ReturnStatus Vm_SegmentDup _ARGS_((register Vm_Segment *srcSegPtr, Proc_ControlBlock *procPtr, Vm_Segment **destSegPtrPtr));
  299. extern void Vm_SegmentDelete _ARGS_((register Vm_Segment *segPtr, Proc_ControlBlock *procPtr));
  300. extern void Vm_ChangeCodeProt _ARGS_((Proc_ControlBlock *procPtr, Address startAddr, int numBytes, Boolean makeWriteable));
  301. extern ReturnStatus Vm_DeleteFromSeg _ARGS_((Vm_Segment *segPtr, int firstPage, int lastPage));
  302.  
  303. /*
  304.  * Procedures for pages.
  305.  */
  306. extern ReturnStatus Vm_PageIn _ARGS_((Address virtAddr, Boolean protFault));
  307. extern void Vm_Clock _ARGS_((ClientData data, Proc_CallInfo *callInfoPtr));
  308. extern int Vm_GetPageSize _ARGS_((void));
  309. extern ReturnStatus Vm_TouchPages _ARGS_ ((int firstPage, int numPages));
  310. ENTRY int Vm_GetRefTime _ARGS_ ((void));
  311.  
  312. /*
  313.  * Procedures for page tables.
  314.  */
  315. extern void Vm_ValidatePages _ARGS_((Vm_Segment *segPtr, int firstPage, int lastPage, Boolean zeroFill, Boolean clobber));
  316.  
  317. /*
  318.  * Procedure to allocate bytes of memory
  319.  */
  320. extern Address Vm_BootAlloc _ARGS_((int numBytes));
  321. extern Address Vm_RawAlloc _ARGS_((int numBytes));
  322.  
  323. /*
  324.  * Procedures for process migration.
  325.  */
  326. extern ReturnStatus Vm_InitiateMigration _ARGS_((Proc_ControlBlock *procPtr, int hostID, Proc_EncapInfo *infoPtr));
  327. extern ReturnStatus Vm_EncapState _ARGS_((register Proc_ControlBlock *procPtr, int hostID, Proc_EncapInfo *infoPtr, Address bufferPtr));
  328. extern ReturnStatus Vm_DeencapState _ARGS_((register Proc_ControlBlock *procPtr, Proc_EncapInfo *infoPtr, Address buffer));
  329. extern ReturnStatus Vm_FinishMigration _ARGS_((register Proc_ControlBlock *procPtr, int hostID, Proc_EncapInfo *infoPtr, Address bufferPtr, int failure));
  330. extern ReturnStatus Vm_EncapSegInfo _ARGS_((int segNum,
  331.     Vm_SegmentInfo *infoPtr));
  332.  
  333. /*
  334.  * Procedure for the file system.
  335.  */
  336. extern int Vm_MapBlock _ARGS_((Address addr));
  337. extern int Vm_UnmapBlock _ARGS_((Address addr, Boolean retOnePage, unsigned int *pageNumPtr));
  338. extern void Vm_FileChanged _ARGS_((Vm_Segment **segPtrPtr));
  339. extern void Vm_FsCacheSize _ARGS_((Address *startAddrPtr, Address *endAddrPtr));
  340.  
  341. /*
  342.  * System calls.
  343.  */
  344. extern ReturnStatus Vm_PageSize _ARGS_((int *pageSizePtr));
  345. extern ReturnStatus Vm_CreateVA _ARGS_((Address address, int size));
  346. extern ReturnStatus Vm_DestroyVA _ARGS_((Address address, int size));
  347. extern ReturnStatus Vm_Cmd _ARGS_((int command, int arg));
  348. extern ReturnStatus Vm_GetSegInfo _ARGS_((Proc_PCBInfo *infoPtr,
  349.     Vm_SegmentID segID, int infoSize, Address segBufPtr));
  350.  
  351. /*
  352.  * Procedures to get to user addresses.
  353.  */
  354. extern ReturnStatus Vm_CopyIn _ARGS_((register int numBytes,
  355.     Address sourcePtr, Address destPtr));
  356. extern ReturnStatus Vm_CopyOut _ARGS_((register int numBytes,
  357.     Address sourcePtr, Address destPtr));
  358. extern ReturnStatus Vm_CopyInProc _ARGS_((int numBytes,
  359.     register Proc_ControlBlock *fromProcPtr, Address fromAddr,
  360.     Address toAddr, Boolean toKernel));
  361. extern ReturnStatus Vm_CopyOutProc _ARGS_((int numBytes, Address fromAddr,
  362.     Boolean fromKernel, register Proc_ControlBlock *toProcPtr,
  363.     Address toAddr));
  364. extern ReturnStatus Vm_StringNCopy _ARGS_((int numBytes,
  365.     Address sourcePtr, Address destPtr, int *bytesCopiedPtr));
  366. extern void Vm_MakeAccessible _ARGS_((int accessType, int numBytes,
  367.     Address startAddr, register int *retBytesPtr,
  368.     register Address *retAddrPtr));
  369. extern void Vm_MakeUnaccessible _ARGS_((Address addr, int numBytes));
  370.  
  371. /* 
  372.  * Procedures for recovery.
  373.  */
  374. extern void Vm_OpenSwapDirectory _ARGS_((ClientData data,
  375.     Proc_CallInfo *callInfoPtr));
  376. extern void Vm_Recovery _ARGS_((void));
  377.  
  378. /*
  379.  * Miscellaneous procedures.
  380.  */
  381. extern Address Vm_GetKernelStack _ARGS_((int invalidPage));
  382. extern void Vm_FreeKernelStack _ARGS_((Address stackBase));
  383. extern void Vm_ProcInit _ARGS_((Proc_ControlBlock *procPtr));
  384. extern ReturnStatus Vm_PinUserMem _ARGS_((int mapType, int numBytes,
  385.     register Address addr));
  386. extern void Vm_UnpinUserMem _ARGS_((int numBytes, Address addr));
  387. extern void Vm_ReservePage _ARGS_((unsigned int pfNum));
  388. extern Boolean VmMach_VirtAddrParse _ARGS_((Proc_ControlBlock *procPtr,
  389.     Address virtAddr, register Vm_VirtAddr *transVirtAddrPtr));
  390.  
  391. /*
  392.  * Routines to provide access to internal virtual memory stuff for the machine
  393.  * dependent code.
  394.  */
  395. extern unsigned int Vm_KernPageAllocate _ARGS_((void));
  396. extern void Vm_KernPageFree _ARGS_((unsigned int pfNum));
  397. extern unsigned int Vm_GetKernPageFrame _ARGS_((int pageFrame));
  398.  
  399. /*
  400.  * Virtual memory tracing routines and variables.
  401.  */
  402. extern    Boolean        vm_Tracing;
  403. extern void Vm_StoreTraceTime _ARGS_((Timer_Ticks timeStamp));
  404.  
  405. /*
  406.  * Shared memory routines.
  407.  */
  408. extern ReturnStatus Vm_Mmap _ARGS_((Address startAddr, int length, int prot,
  409.     int share, int streamID, int fileAddr, Address *mappedAddr));
  410. extern ReturnStatus Vm_Munmap _ARGS_((Address startAddr, int length,
  411.     int noError));
  412. extern ReturnStatus Vm_Msync _ARGS_((Address startAddr, int length));
  413. extern ReturnStatus Vm_Mlock _ARGS_((Address startAddr, int length));
  414. extern ReturnStatus Vm_Munlock _ARGS_((Address startAddr, int length));
  415. extern ReturnStatus Vm_Mincore _ARGS_((Address startAddr, int length,
  416.     char *retVec));
  417. extern ReturnStatus Vm_Mprotect _ARGS_((Address startAddr, int length,
  418.     int prot));
  419. extern void Vm_CleanupSharedFile _ARGS_((Proc_ControlBlock *procPtr,
  420.     Fs_Stream *streamPtr));
  421. extern void Vm_CleanupSharedProc _ARGS_((Proc_ControlBlock *procPtr));
  422. extern void Vm_DeleteSharedSegment _ARGS_((Proc_ControlBlock *procPtr,
  423.     Vm_SegProcList *segProcPtr));
  424. extern void Vm_CopySharedMem _ARGS_((Proc_ControlBlock *parentProcPtr,
  425.     Proc_ControlBlock *childProcPtr));
  426.  
  427. /*
  428.  * Machine-dependent routines exported to other modules.
  429.  */
  430. /*
  431.  * Device mapping.
  432.  */
  433. extern Address VmMach_DMAAlloc _ARGS_((int numBytes, Address srcAddr));
  434. extern void VmMach_DMAFree _ARGS_((int numBytes, Address mapAddr));
  435. extern ReturnStatus VmMach_MapKernelIntoUser _ARGS_((unsigned int
  436.         kernelVirtAddr, int numBytes, unsigned int userVirtAddr,
  437.         unsigned int *realVirtAddrPtr));
  438.  
  439. /*
  440.  * Routines to manage contexts.
  441.  */
  442. extern void VmMach_FreeContext _ARGS_((register Proc_ControlBlock *procPtr));
  443. extern void VmMach_ReinitContext _ARGS_((register Proc_ControlBlock *procPtr));
  444. extern ClientData VmMach_SetupContext _ARGS_((register Proc_ControlBlock
  445.         *procPtr));
  446.  
  447. /*
  448.  * Initialization
  449.  */
  450. extern void VmMach_BootInit _ARGS_((int *pageSizePtr, int *pageShiftPtr,
  451.         int *pageTableIncPtr, int *kernMemSizePtr, int *numKernPagesPtr,
  452.         int *maxSegsPtr, int *maxProcessesPtr));
  453. extern Address VmMach_AllocKernSpace _ARGS_((Address baseAddr));
  454. extern void VmMach_Init _ARGS_((int firstFreePage));
  455.  
  456. /*
  457.  * Segment creation, expansion, and destruction.
  458.  */
  459. extern void VmMach_SegInit _ARGS_((struct Vm_Segment *segPtr));
  460. extern void VmMach_SegExpand _ARGS_((register struct Vm_Segment *segPtr,
  461.         int firstPage, int lastPage));
  462. extern void VmMach_SegDelete _ARGS_((register struct Vm_Segment *segPtr));
  463.  
  464. /*
  465.  * Process initialization.
  466.  */
  467. extern void VmMach_ProcInit _ARGS_((register struct Vm_ProcInfo *vmPtr));
  468.  
  469. /*
  470.  * Manipulating protection.
  471.  */
  472. extern void VmMach_SetSegProt _ARGS_((register struct Vm_Segment *segPtr,
  473.         register int firstPage, int lastPage, Boolean makeWriteable));
  474. extern void VmMach_SetPageProt _ARGS_((register struct Vm_VirtAddr
  475.         *virtAddrPtr, Vm_PTE softPTE));
  476.  
  477. /*
  478.  * Reference and modify bits.
  479.  */
  480. extern void VmMach_GetRefModBits _ARGS_((register struct Vm_VirtAddr
  481.         *virtAddrPtr, unsigned int virtFrameNum, register Boolean *refPtr,
  482.         register Boolean *modPtr));
  483. extern void VmMach_ClearRefBit _ARGS_((register struct Vm_VirtAddr
  484.     *virtAddrPtr, unsigned int virtFrameNum));
  485. extern void VmMach_ClearModBit _ARGS_((register struct Vm_VirtAddr
  486.     *virtAddrPtr, unsigned int virtFrameNum));
  487. extern void VmMach_AllocCheck _ARGS_((register struct Vm_VirtAddr
  488.     *virtAddrPtr, unsigned int virtFrameNum, register Boolean *refPtr,
  489.         register Boolean *modPtr));
  490.  
  491. /*
  492.  * Page validation and invalidation.
  493.  */
  494. extern void VmMach_PageValidate _ARGS_((register struct Vm_VirtAddr
  495.     *virtAddrPtr, Vm_PTE pte));
  496. extern void VmMach_PageInvalidate _ARGS_((register struct Vm_VirtAddr
  497.     *virtAddrPtr, unsigned int virtPage, Boolean segDeletion));
  498.  
  499. /*
  500.  * Routine to parse a virtual address.
  501.  */
  502. extern Boolean VmMach_VirtAddrParse _ARGS_((Proc_ControlBlock *procPtr,
  503.         Address virtAddr, register struct Vm_VirtAddr *transVirtAddrPtr));
  504.  
  505. /*
  506.  * Routines to copy data to/from user space.
  507.  */
  508. extern ReturnStatus VmMach_CopyInProc _ARGS_((int numBytes,
  509.         Proc_ControlBlock *fromProcPtr, Address fromAddr,
  510.         struct Vm_VirtAddr *virtAddrPtr, Address toAddr, Boolean toKernel));
  511. extern ReturnStatus VmMach_CopyOutProc _ARGS_((int numBytes,
  512.         Address fromAddr, Boolean fromKernel, Proc_ControlBlock *toProcPtr,
  513.         Address toAddr, struct Vm_VirtAddr *virtAddrPtr));
  514.  
  515. /*
  516.  * Tracing.
  517.  */
  518. extern void VmMach_Trace _ARGS_((void));
  519.  
  520. /*
  521.  * Pinning and unpinning user memory pages.
  522.  */
  523. extern void VmMach_PinUserPages _ARGS_((int mapType, struct Vm_VirtAddr
  524.         *virtAddrPtr, int lastPage));
  525. extern void VmMach_UnpinUserPages _ARGS_((struct Vm_VirtAddr *virtAddrPtr,
  526.         int lastPage));
  527. /*
  528.  * Cache flushing.
  529.  */
  530. extern void VmMach_FlushPage _ARGS_((struct Vm_VirtAddr *virtAddrPtr,
  531.         Boolean invalidate));
  532. extern void VmMach_FlushCode _ARGS_((Proc_ControlBlock *procPtr,
  533.         struct Vm_VirtAddr *virtAddrPtr, unsigned virtPage, int numBytes));
  534. extern void VmMach_FlushByteRange _ARGS_((Address virtAddr, int numBytes));
  535. /*
  536.  * Migration.
  537.  */
  538. extern void VmMach_HandleSegMigration _ARGS_((struct Vm_Segment *segPtr));
  539.  
  540. extern ReturnStatus VmMach_Cmd _ARGS_((int command, int arg));
  541.  
  542. /*
  543.  * Shared memory.
  544.  */
  545. extern void VmMach_SharedSegFinish _ARGS_((Proc_ControlBlock *procPtr,
  546.         Address addr));
  547. extern void VmMach_SharedProcStart _ARGS_((Proc_ControlBlock *procPtr));
  548. extern void VmMach_SharedProcFinish _ARGS_((Proc_ControlBlock *procPtr));
  549. extern void VmMach_CopySharedMem _ARGS_((Proc_ControlBlock *parentProcPtr,
  550.         Proc_ControlBlock *childProcPtr));
  551. extern ReturnStatus VmMach_SharedStartAddr _ARGS_((Proc_ControlBlock *procPtr,
  552.         int size, Address *reqAddr, int fixed));
  553.  
  554.  
  555. #endif /* _VM */
  556.